//
// Created by Administrator on 2020/11/08.
//

#ifndef MYNDK_DNFFMEPEG_H
#define MYNDK_DNFFMEPEG_H
#include <pthread.h>
#include "JavaCallHelper.h"
#include "VideoChannel.h"
extern "C"{
#include <libavformat/avformat.h>
}
#include "AudioChannel.h"

class DNFFmepeg {

public:
    DNFFmepeg(JavaCallHelper* callHelper,const char *dataSource);
    ~DNFFmepeg();
    void prepare();
    void _prepare();

    void start();
    void _start();

    void setRenderFrameCallback(RenderFrameCallback callback);
private:
    char *dataSource;
    JavaCallHelper* callHelper;
    pthread_t pid;
    AVFormatContext *formatContext;
    bool isPlaying;
    VideoChannel* videoChannel;
    AudioChannel* audioChannel;
    pthread_t pid_play;
    RenderFrameCallback callback;

};


#endif //MYNDK_DNFFMEPEG_H
